RGB Function

Returns a Color based on the red, green, and blue values specified. You can also specify a color using the HSV or CMY function or the & color constant, &cRRBBGG.

Syntax

result = RGB( red, green, blue )


Parameters

red

Integer

The amount of red in the color (0-255).

green

Integer

The amount of green in the color (0-255).

blue

Integer

The amount of blue in the color (0-255).



Notes

The RGB function returns a color object based on the amounts of red, green, and blue passed. These amounts are represented by integers between 0 and 255.

You can also specify a color using the RGB model using the &c literal. With the &c literal, you specify the amounts of red, green, and blue in hexidecimal rather than decimal.


Examples

This example uses the Rgb function to assign various colors to the ForeColor property of a Canvas control.

canvas1. Graphics.forecolor=Rgb(0,0,0)
//set to black
canvas1. Graphics.forecolor=Rgb(255,0,0)
//set to red
canvas1. Graphics.forecolor=Rgb(255,255,255)
//set to white

See Also

Color data type; CMY, HSV, SelectColor functions; &c literal.